<script setup>
import {useRouter} from "vue-router";
import {useMenuStore} from "../../store/menu.js";

const linkData = [
  {key: "problem", text: "编程练习", path: "/problem/list"},
  {key: "problem", text: "添加习题", path: "/problem/add"},
  {key: "student", text: "上课记录", path: "/student/course_list"},
  {key: "student", text: "添加上课记录", path: "/student/record_add"},
  {key: "student", text: "添加学生", path: "/student/add"},
  {key: "student", text: "学生列表", path: "/student/list"},
  {key: "student", text: "上课记录列表", path: "/student/record_list"},
  {key: "file", text: "文件上传", path: "/file/upload"},
  {key: "file", text: "音乐列表", path: "/file/music_list"},
]
const store = useMenuStore()
const router = useRouter()
const onLinkClick = (key, path) => {
  store.setSelectedKeys([key])
  router.push(path)
}
</script>
<template>
  <a-row :gutter="[16,16]">
    <a-col
        :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="8"
        v-for="(v,k) in linkData"
        :key="k"
    >
      <a-button
          type="primary"
          block
          @click="onLinkClick(v.key, v.path)"
      >
        {{ v.text }}
      </a-button>
    </a-col>
  </a-row>
</template>
